<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
    
  
  <link href="//cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/lh706.github.io/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="JavaScript,总结," />








  <link rel="shortcut icon" type="image/x-icon" href="/lh706.github.io/favicon.ico?v=5.1.1" />






<meta name="description" content="基础1234普通---立即执行async---异步加载,立即执行,不按照顺序执行defer---异步加载,最后执行&amp;lt;noscript&amp;gt;">
<meta name="keywords" content="JavaScript,总结">
<meta property="og:type" content="article">
<meta property="og:title" content="js语法总结">
<meta property="og:url" content="https://lh706.github.io/lh706.github.io/2017/05/20/js语法总结/index.html">
<meta property="og:site_name" content="Albert的blog">
<meta property="og:description" content="基础1234普通---立即执行async---异步加载,立即执行,不按照顺序执行defer---异步加载,最后执行&amp;lt;noscript&amp;gt;">
<meta property="og:updated_time" content="2017-05-20T03:37:18.414Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="js语法总结">
<meta name="twitter:description" content="基础1234普通---立即执行async---异步加载,立即执行,不按照顺序执行defer---异步加载,最后执行&amp;lt;noscript&amp;gt;">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/lh706.github.io/',
    scheme: 'Mist',
    sidebar: {"position":"right","display":"always","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://lh706.github.io/lh706.github.io/2017/05/20/js语法总结/"/>





  <title>js语法总结 | Albert的blog</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/lh706.github.io/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Albert的blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description"></h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/lh706.github.io/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/lh706.github.io/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/lh706.github.io/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-tags " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://lh706.github.io/lh706.github.io/lh706.github.io/2017/05/20/js语法总结/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Albert">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/lh706.github.io/my.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Albert的blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">js语法总结</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-05-20T11:02:09+08:00">
                2017-05-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="基础"><a href="#基础" class="headerlink" title="基础"></a>基础</h2><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">普通---立即执行</div><div class="line"><span class="keyword">async</span>---异步加载,立即执行,不按照顺序执行</div><div class="line">defer---异步加载,最后执行</div><div class="line">&lt;noscript&gt;</div></pre></td></tr></table></figure>
<a id="more"></a>
<h3 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">Number</span></div><div class="line">    <span class="literal">NaN</span>---未知的数值 通过inNaN(判断是否能转化为数值)来判断</div><div class="line">    infinity</div><div class="line">    指数形式:aE+n a乘<span class="number">10</span>的n次方,<span class="number">11E-3</span> ===&gt; <span class="number">11</span>*<span class="number">10</span>^<span class="number">-3</span> = <span class="number">0.011</span></div><div class="line"><span class="literal">undefined</span>---未定义</div><div class="line">Null---空对象指针</div><div class="line"><span class="built_in">String</span></div><div class="line"><span class="built_in">Boolean</span></div><div class="line"><span class="built_in">Object</span></div><div class="line"><span class="keyword">typeof</span>操作符:<span class="literal">undefined</span> boolead string number object(<span class="literal">null</span>) <span class="function"><span class="keyword">function</span></span></div><div class="line">基本转义字符 \<span class="title">n</span>换行,\<span class="title">b</span>空格</div></pre></td></tr></table></figure>
<h3 id="控制结构"><a href="#控制结构" class="headerlink" title="控制结构"></a>控制结构</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div></pre></td><td class="code"><pre><div class="line"><span class="number">1.</span><span class="keyword">do</span>-<span class="keyword">while</span></div><div class="line">先执行,再判断</div><div class="line"><span class="number">2.</span><span class="keyword">while</span></div><div class="line">判断再执行</div><div class="line"><span class="number">3.</span><span class="keyword">for</span></div><div class="line">---都是为假就跳出循环</div><div class="line"><span class="number">4.</span><span class="keyword">for</span>-<span class="keyword">in</span>-迭代读取对象的key,可能不会按照顺序读取...</div><div class="line"><span class="number">5.</span>label,<span class="keyword">break</span>,<span class="keyword">continue</span></div><div class="line"><span class="number">6.</span><span class="keyword">with</span>---将代码的作用域设定到特定对象中</div><div class="line"><span class="keyword">with</span>(a)&#123;</div><div class="line">    <span class="keyword">var</span> x=b;</div><div class="line">    <span class="keyword">var</span> y=c;</div><div class="line">&#125;---将作用域设定到a对象中;</div><div class="line">等同于</div><div class="line"><span class="keyword">var</span> x=a.b;</div><div class="line"><span class="keyword">var</span> y=a.c;</div><div class="line"><span class="number">7.</span><span class="keyword">switch</span></div><div class="line">    <span class="keyword">case</span> x : 语句;<span class="keyword">break</span>;</div><div class="line">    <span class="keyword">default</span>: 语句;</div></pre></td></tr></table></figure>
<h3 id="变量-作用域和内存"><a href="#变量-作用域和内存" class="headerlink" title="变量,作用域和内存"></a>变量,作用域和内存</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line">变量类型:</div><div class="line">基本类型---简单数据段</div><div class="line">引用类型---对象类</div><div class="line"><span class="number">1.</span>对于直接赋值 a=b</div><div class="line">基本类型传递值</div><div class="line">引用类型传递指针,所以改变b,a会改变;</div><div class="line"><span class="number">2.</span>对于向函数传递参数</div><div class="line">都是传递值;</div><div class="line"></div><div class="line">执行环境及作用域</div><div class="line"><span class="function"><span class="keyword">function</span>  <span class="title">a</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="function"><span class="keyword">function</span> <span class="title">b</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    &#125;</div><div class="line">&#125;</div><div class="line">环境栈: ↓</div><div class="line">        b的环境对象---活动对象,包括<span class="built_in">arguments</span>变量</div><div class="line">        a的环境对象---第二级作用域</div><div class="line">        <span class="built_in">window</span>---全局作用域</div></pre></td></tr></table></figure>
<h3 id="引用类型"><a href="#引用类型" class="headerlink" title="引用类型"></a>引用类型</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div></pre></td><td class="code"><pre><div class="line">通过<span class="keyword">new</span>或者字面量的形式创建</div><div class="line">公共方法:</div><div class="line">    tostring()</div><div class="line">    tolocalstring()</div><div class="line">    valueof()</div><div class="line">引用类型包括以下几类:</div><div class="line"><span class="number">1.</span>object</div><div class="line"><span class="number">2.</span>array</div><div class="line"><span class="number">3.</span>date</div><div class="line">    获得时间</div><div class="line">     <span class="keyword">var</span> now = <span class="keyword">new</span> <span class="built_in">Date</span>;</div><div class="line">     然后通过getTime()等方法</div><div class="line">    创建时间</div><div class="line">     <span class="keyword">var</span> dateTime = <span class="keyword">new</span> <span class="built_in">Date</span>(<span class="string">"2016/05/20 23:42:00"</span>);</div><div class="line"><span class="number">4.</span><span class="built_in">RegExp</span></div><div class="line"><span class="number">5.</span><span class="built_in">Function</span></div><div class="line"><span class="number">6.</span>包装类型-boolean,string,number</div><div class="line"></div><div class="line"><span class="keyword">var</span> a=<span class="string">'xx'</span>;</div><div class="line"><span class="keyword">var</span> b=a.length; b=<span class="number">2</span>;</div><div class="line">相当于:</div><div class="line"><span class="keyword">var</span> a=<span class="string">'xx'</span>;</div><div class="line">a1=<span class="keyword">new</span> string(<span class="string">'xx'</span>);</div><div class="line">b=a1.length;</div><div class="line">a1=<span class="literal">null</span>;</div><div class="line">基本数据类型能使用方法,是因为转换成了这些包装类型,然后立即被释放;</div><div class="line">a.color=<span class="string">'red'</span>;---a变成包装类型string,添加属性color,然后被释放</div><div class="line">alert(a.color);---<span class="literal">undefined</span>,又变成了基本类型.</div><div class="line"></div><div class="line">var value=<span class="string">'1'</span>;</div><div class="line"><span class="built_in">Number</span>(value);---转换函数,转成数值</div><div class="line"><span class="keyword">new</span> <span class="built_in">Number</span>(value);---构造函数,构造了一个包装类型</div><div class="line"><span class="number">7.</span>单体内置对象</div><div class="line">Global</div><div class="line">    全局对象---最底层的对象---没有直接调用的方法,只有通过<span class="built_in">window</span>对象调用</div><div class="line">    <span class="built_in">window</span>对象是Global(js语法中的最底层对象)与浏览器对象之和;</div><div class="line"><span class="built_in">Math</span></div></pre></td></tr></table></figure>
<h2 id="面向对象"><a href="#面向对象" class="headerlink" title="面向对象"></a>面向对象</h2><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div><div class="line">150</div><div class="line">151</div></pre></td><td class="code"><pre><div class="line">对于一个属性--由一个name,<span class="number">6</span>个特性组成;</div><div class="line">可配置性 configurable ---能否<span class="keyword">delete</span>删除;能否修改特效;能否设置为访问器属性;</div><div class="line">可枚举性 enumerable---能否<span class="keyword">for</span>-<span class="keyword">in</span></div><div class="line">数据属性:</div><div class="line">可修改性 writable</div><div class="line">数值 value---默认<span class="literal">undefined</span></div><div class="line">访问器属性:(es5标准,ie8及以下没有--主要 适用与移动端);</div><div class="line">set</div><div class="line">get</div><div class="line"></div><div class="line">前三个特性,默认<span class="literal">true</span>,但是如果开始设置,任意一个特性,其余的默认<span class="literal">false</span>;   </div><div class="line">数据属性和访问器属性不能混用;</div><div class="line"></div><div class="line"><span class="keyword">var</span> a = &#123;&#125;;</div><div class="line"><span class="built_in">Object</span>.defineProperty(a,<span class="string">"name"</span>,&#123;</div><div class="line">    <span class="attr">value</span>:<span class="string">"lh"</span>,</div><div class="line">    <span class="attr">writable</span>:<span class="literal">false</span>          --- 这个时候,其余两个属性设置为了<span class="literal">false</span>;</div><div class="line">&#125;)</div><div class="line"><span class="keyword">var</span> b = <span class="built_in">Object</span>.getOwnPropertyDescriptor(a,<span class="string">"name"</span>);</div><div class="line">得到特性名=&gt;值组成的对象;</div><div class="line"></div><div class="line"><span class="built_in">Object</span>.defineProperty(a,<span class="string">"name"</span>,&#123;</div><div class="line">    <span class="attr">set</span>:<span class="function"><span class="keyword">function</span>(<span class="params">e</span>)</span>&#123;</div><div class="line">        <span class="keyword">this</span>.name=e+<span class="number">1</span>;</div><div class="line">    &#125;</div><div class="line">设置多个属性</div><div class="line"><span class="built_in">Object</span>.defineProperties(a,&#123;</div><div class="line">    <span class="attr">name</span>:&#123;&#125;,</div><div class="line">    <span class="attr">vale</span>:&#123;&#125;</div><div class="line">&#125;)</div><div class="line"></div><div class="line"><span class="built_in">Object</span>模式  </div><div class="line"><span class="keyword">var</span> x = <span class="keyword">new</span> <span class="built_in">Object</span>()</div><div class="line">x.name=<span class="string">''</span>;</div><div class="line">...</div><div class="line"></div><div class="line">对象字面量</div><div class="line"><span class="keyword">var</span> x = &#123;</div><div class="line">    <span class="attr">name</span>:<span class="string">''</span>,</div><div class="line">    ...</div><div class="line">    &#125;</div><div class="line">    </div><div class="line">工厂模式</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">x</span> (<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="keyword">var</span> o = <span class="keyword">new</span> <span class="built_in">Object</span>();</div><div class="line">    o.name=<span class="string">''</span>;</div><div class="line">    ...;</div><div class="line">    <span class="keyword">return</span> o;</div><div class="line">&#125;</div><div class="line"></div><div class="line">构造函数</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">x</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="keyword">this</span>.name=<span class="string">''</span>;</div><div class="line">    &#125;</div><div class="line"><span class="keyword">var</span> y =<span class="keyword">new</span> x (); </div><div class="line"></div><div class="line">除了构造函数,这几种方法原型链都是</div><div class="line">对象--对象原型(<span class="built_in">Object</span>.prototype)--<span class="literal">null</span></div><div class="line">构造函数是</div><div class="line">实例化的对象(y)--实例原型(y.__proto__/x.prototype)--对象原型(<span class="built_in">Object</span>.prototype)--<span class="literal">null</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">a</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="keyword">this</span>.fn=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;&#125;</div><div class="line">&#125;---构造函数a中创建一个方法fn;</div><div class="line"><span class="keyword">var</span> b1 = <span class="keyword">new</span> a();</div><div class="line"><span class="keyword">var</span> b2 = <span class="keyword">new</span> a();</div><div class="line">这个时候 b1.fn并不等于b2.fn;</div><div class="line">要他们共用一个方法,要将方法放在原型a上;</div><div class="line">a.prototype.fn = <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;...&#125;;</div><div class="line"></div><div class="line">----------------------------------------</div><div class="line">实际使用:</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">student</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="keyword">this</span>.name=prop.name||<span class="string">"匿名"</span>;</div><div class="line">&#125;;</div><div class="line">student.prototype.fn=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;...&#125;;</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">createstudent</span>(<span class="params">prop</span>)</span>&#123;</div><div class="line">    <span class="keyword">return</span> <span class="keyword">new</span> student(prop||&#123;&#125;);</div><div class="line">&#125;</div><div class="line">---然后直接用 <span class="keyword">var</span> xiaoming = createstudent();来创建</div><div class="line"><span class="number">1.</span>不要<span class="keyword">new</span></div><div class="line"><span class="number">2.</span>传参数不用管顺序,和有没有,还能设置默认值...</div><div class="line"><span class="number">3.</span>完全匹配json数据;</div><div class="line"><span class="keyword">var</span> x = createstudent(&#123;</div><div class="line">    <span class="string">"name"</span>:<span class="string">"xiaoming"</span>,</div><div class="line">    ...</div><div class="line">&#125;) </div><div class="line"></div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">mor</span>(<span class="params">obj</span>) </span>&#123;</div><div class="line">    <span class="keyword">var</span> rs = [];</div><div class="line">    <span class="keyword">while</span>(obj) &#123;</div><div class="line">       rs.push(obj);</div><div class="line">       obj = <span class="built_in">Object</span>.getPrototypeOf(obj);</div><div class="line">    &#125; </div><div class="line">    <span class="keyword">return</span> rs;</div><div class="line">&#125;</div><div class="line"></div><div class="line"></div><div class="line">原型上的变量,实例中赋值后,变成不继承了??--继承,但是优先级不同</div><div class="line">q.hasOwnProperty(<span class="string">"vv"</span>) <span class="literal">true</span></div><div class="line">w.hasOwnProperty(<span class="string">"vv"</span>) flase  --</div><div class="line">在q中添加了vv属性,因为调用是从上至下的,所以现在实例中查找,再去原型--</div><div class="line">可以通过<span class="keyword">delete</span> q.vv;然后调用的又是原型中的了.</div><div class="line"></div><div class="line"> 实例a   <span class="keyword">constructor</span>--&gt;b  prototype--&gt;undefined  __proto__--&gt;c	</div><div class="line"> 构造函数b   <span class="keyword">constructor</span>--&gt;functon Function()&#123;&#125;  prototype--&gt;c  __proto__--&gt;<span class="function"><span class="keyword">function</span> <span class="title">Empty</span>(<span class="params"></span>)</span>&#123;&#125;	</div><div class="line"> 原型c	  <span class="keyword">constructor</span>--&gt;b  prototype--&gt;undefined  __proto__--&gt;Object	</div><div class="line"></div><div class="line"></div><div class="line">__proto__才是原型,继承.</div><div class="line">定义函数时,就会有construct和prototype出现</div><div class="line"> 函数的原型是个对象,继承自Object;</div><div class="line">------------------------------------------------------------------------------------------------</div><div class="line"></div><div class="line"></div><div class="line">构造函数模式+原型模式实际运用</div><div class="line">var prop = &#123;</div><div class="line">	name:<span class="string">"gou"</span>,</div><div class="line">	<span class="attr">cat</span>:<span class="string">"miao"</span></div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">a</span>(<span class="params"></span>)</span>&#123;</div><div class="line">	<span class="keyword">this</span>.cat=prop.cat||<span class="string">'mao'</span> </div><div class="line">&#125;;</div><div class="line">a.prototype=&#123;</div><div class="line">	<span class="attr">constructor</span>:a,</div><div class="line">	建立对象的时候,设置原型的时候.只能单个设置</div><div class="line">eg:</div><div class="line">    a.prototype.name:<span class="string">'="name'</span>,</div><div class="line">	<span class="attr">say</span>:<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</div><div class="line">		<span class="keyword">return</span> <span class="keyword">this</span>.say+<span class="keyword">this</span>.name;</div><div class="line">	&#125;</div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">createA</span>(<span class="params"></span>)</span>&#123;</div><div class="line">	<span class="keyword">return</span> <span class="keyword">new</span> a (prop||&#123;&#125;)</div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="keyword">var</span> b = createA(prop);</div><div class="line"></div><div class="line">稳妥构造模式</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">a</span> (<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="keyword">var</span> o = <span class="keyword">new</span> <span class="built_in">Object</span>();</div><div class="line">    name=<span class="string">"xx"</span>;</div><div class="line">    o.sayname=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</div><div class="line">        alert(name);</div><div class="line">    &#125;</div><div class="line">    <span class="keyword">return</span> o;</div><div class="line">&#125;</div><div class="line">适应在需要安全的地方--除了o.sayname方法,无法访问内部属性;</div></pre></td></tr></table></figure>
<h2 id="函数"><a href="#函数" class="headerlink" title="函数"></a>函数</h2><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div></pre></td><td class="code"><pre><div class="line">闭包:</div><div class="line">能访问函数内部.</div><div class="line">匿名函数的返回---</div><div class="line">			<span class="function"><span class="keyword">function</span> <span class="title">a</span>(<span class="params">x</span>)</span>&#123;</div><div class="line">				<span class="keyword">var</span> t=<span class="string">'he'</span>;</div><div class="line">				<span class="built_in">console</span>.info(x);						</div><div class="line">				<span class="keyword">return</span> <span class="function"><span class="keyword">function</span> (<span class="params">x</span>)</span>&#123;</div><div class="line">				<span class="built_in">console</span>.info(t,x,<span class="keyword">this</span>);</div><div class="line">				&#125;</div><div class="line">			&#125;</div><div class="line">		<span class="keyword">var</span> b=a(<span class="string">'he'</span>);---<span class="string">'he'</span>,b=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;...&#125;;<span class="keyword">this</span>指向windows,但是环境仍然为a;</div><div class="line">		能访问到t,x又作为匿名函数的参数了,所以如b不赋值,则为<span class="literal">undefined</span>;</div><div class="line">	    b(<span class="string">'he'</span>);---<span class="string">'he,he,window'</span>;</div><div class="line">严格模式下,不能使用<span class="built_in">arguments</span>.callee;</div><div class="line"><span class="keyword">var</span> a = (<span class="function"><span class="keyword">function</span> <span class="title">b</span>(<span class="params"></span>)</span>&#123;&#125;)---用来内部调用自己;</div><div class="line">闭包用途:</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">a</span>(<span class="params"></span>)</span>&#123;</div><div class="line">	<span class="keyword">var</span> x=<span class="number">1</span>;</div><div class="line">	add=<span class="function"><span class="keyword">function</span>(<span class="params">t</span>)</span>&#123;</div><div class="line">		x=x+t;</div><div class="line">		<span class="built_in">console</span>.info(x);</div><div class="line">	&#125;;</div><div class="line">	<span class="keyword">return</span> <span class="function"><span class="keyword">function</span> <span class="title">b</span>(<span class="params"></span>)</span>&#123;</div><div class="line">		x++;</div><div class="line">	<span class="built_in">console</span>.info(x);</div><div class="line">	&#125;;</div><div class="line"></div><div class="line">&#125;</div><div class="line"><span class="keyword">var</span> b=a();</div><div class="line">b();<span class="number">2</span></div><div class="line">b();<span class="number">3</span></div><div class="line">add(<span class="number">1</span>);<span class="number">5</span></div><div class="line"></div><div class="line">---通过闭包,b函数赋予给全局变量b,b函数又依赖a,所以将a环境一直保存在内存中了...</div><div class="line">add没用<span class="keyword">var</span>创建,所以是个能访问a内部的全局函数,可以用来设置a内的变量;</div></pre></td></tr></table></figure>
<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><h3 id="错误处理"><a href="#错误处理" class="headerlink" title="错误处理"></a>错误处理</h3><pre><code>所以抛出的错误都是error对象的实例
</code></pre><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div></pre></td><td class="code"><pre><div class="line">error对象:</div><div class="line">    message:错误提示信息</div><div class="line">    name：错误名称（非标准属性）</div><div class="line">    stack：错误的堆栈（非标准属性)</div><div class="line">派生的六种对象</div><div class="line"><span class="number">1.</span>syntaxError---语法错误</div><div class="line"><span class="number">2.</span>refrenceError---引用了不存在的变量</div><div class="line"><span class="number">3.</span>rangeError---超出范围</div><div class="line"><span class="number">4.</span>typeError---使用变量或参数不是预期类型</div><div class="line"><span class="number">5.</span><span class="built_in">URIError</span>---URI相关函数的参数不正确</div><div class="line"><span class="number">6.</span><span class="built_in">EvalError</span>---Eval函数没有正确执行</div><div class="line">自定义错误:</div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">a</span>(<span class="params"></span>)</span>&#123;&#125;</div><div class="line">a.prototype=<span class="keyword">new</span> <span class="built_in">Error</span>;</div><div class="line">a.contructor=a;</div><div class="line"><span class="keyword">var</span> b=<span class="keyword">new</span> a;</div><div class="line"></div><div class="line"><span class="keyword">throw</span>语法</div><div class="line"><span class="keyword">throw</span>抛出一个对象,然后中断</div><div class="line"><span class="keyword">try</span>&#123;&#125;</div><div class="line"><span class="keyword">catch</span>()&#123;&#125;</div><div class="line"><span class="keyword">finally</span>&#123;&#125;</div><div class="line">执行<span class="keyword">try</span>中的语句,如果完成,执行<span class="keyword">finally</span>语句</div><div class="line">如果错误,<span class="keyword">catch</span>捕获错误(不抛出错误),然后执行<span class="keyword">catch</span>语句,再<span class="keyword">finally</span>语句</div></pre></td></tr></table></figure>
<h3 id="常用操作符与方法汇总"><a href="#常用操作符与方法汇总" class="headerlink" title="常用操作符与方法汇总"></a>常用操作符与方法汇总</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div></pre></td><td class="code"><pre><div class="line">操作符</div><div class="line"><span class="keyword">typeof</span>---主要检测基本类型</div><div class="line"><span class="keyword">instanceof</span>---主要检测引用类型 检测对象的cunstructor</div><div class="line"><span class="number">1.</span><span class="built_in">Object</span></div><div class="line">实例 <span class="keyword">instanceof</span> 原型</div><div class="line"><span class="built_in">Object</span>.getPrototypeOf() 获得对象的原型</div><div class="line"><span class="built_in">Object</span>.constructor 对象的构造函数 </div><div class="line"><span class="built_in">Object</span>.hasOwnProperty( ) 检查属性是否被继承 </div><div class="line"><span class="built_in">Object</span>.isPrototypeOf(a) 一个对象是否是另一个对象的原型 (a原型链上是否有<span class="built_in">Object</span>);</div><div class="line"><span class="built_in">Object</span>.propertyIsEnumerable( ) 是否可以通过<span class="keyword">for</span>/<span class="keyword">in</span>循环看到属性 </div><div class="line"><span class="built_in">Object</span>.toLocaleString( ) 返回对象的本地字符串表示 </div><div class="line"><span class="built_in">Object</span>.toString( ) 定义一个对象的字符串表示 </div><div class="line"><span class="built_in">Object</span>.valueOf( ) 指定对象的原始值 </div><div class="line"><span class="number">2.</span><span class="built_in">Array</span></div><div class="line"><span class="built_in">Array</span>.concat( ) 连接数组 </div><div class="line"><span class="built_in">Array</span>.join( ) 将数组元素连接起来以构建一个字符串 </div><div class="line"><span class="built_in">Array</span>.length 数组的大小 </div><div class="line"><span class="built_in">Array</span>.pop( ) 删除并返回数组的最后一个元素 </div><div class="line"><span class="built_in">Array</span>.push( ) 给数组添加元素 </div><div class="line"><span class="built_in">Array</span>.reverse( ) 颠倒数组中元素的顺序 </div><div class="line"><span class="built_in">Array</span>.shift( ) 将元素移出数组 </div><div class="line"><span class="built_in">Array</span>.slice( ) 返回数组的一部分 </div><div class="line"><span class="built_in">Array</span>.sort( ) 对数组元素进行排序 </div><div class="line"><span class="built_in">Array</span>.splice( ) 插入、删除或替换数组的元素 </div><div class="line"><span class="built_in">Array</span>.toLocaleString( ) 把数组转换成局部字符串 </div><div class="line"><span class="built_in">Array</span>.toString( ) 将数组转换成一个字符串 </div><div class="line"><span class="built_in">Array</span>.unshift( ) 在数组头部插入一个元素 </div><div class="line"><span class="built_in">Array</span>.</div><div class="line"></div><div class="line"></div><div class="line"><span class="number">3.</span><span class="built_in">Boolean</span></div><div class="line"><span class="built_in">Boolean</span>.toString( ) 将布尔值转换成字符串 </div><div class="line"><span class="built_in">Boolean</span>.valueOf( ) <span class="built_in">Boolean</span>对象的布尔值 </div><div class="line"><span class="number">4.</span><span class="built_in">Function</span></div><div class="line"><span class="built_in">Function</span>.apply( ) 将函数作为一个对象的方法调用 </div><div class="line"><span class="built_in">Function</span>.arguments[] 传递给函数的参数 </div><div class="line"><span class="built_in">Function</span>.call( ) 将函数作为对象的方法调用 </div><div class="line"><span class="built_in">Function</span>.caller 调用当前函数的函数 </div><div class="line"><span class="built_in">Function</span>.length 已声明的参数的个数 </div><div class="line"><span class="built_in">Function</span>.prototype 对象类的原型 </div><div class="line"><span class="built_in">Function</span>.toString( ) 把函数转换成字符串 </div><div class="line"><span class="number">5.</span><span class="built_in">Number</span></div><div class="line"><span class="built_in">Number</span>.MAX_VALUE 最大数值 </div><div class="line"><span class="built_in">Number</span>.MIN_VALUE 最小数值 </div><div class="line"><span class="built_in">Number</span>.NaN 特殊的非数字值 </div><div class="line"><span class="built_in">Number</span>.toLocaleString( ) 把数字转换成本地格式的字符串 </div><div class="line"><span class="built_in">Number</span>.toPrecision( ) 格式化数字的有效位 </div><div class="line"><span class="built_in">Number</span>.toString( ) 将—个数字转换成字符串 </div><div class="line"><span class="built_in">Number</span>.valueOf( ) 返回原始数值 </div><div class="line"><span class="number">6.</span><span class="built_in">String</span>（字符串对象）</div><div class="line"><span class="built_in">String</span>.charAt( ) 返回字符串中的第n个字符 </div><div class="line"><span class="built_in">String</span>.charCodeAt( ) 返回字符串中的第n个字符的代码 </div><div class="line"><span class="built_in">String</span>.concat( ) 连接字符串 </div><div class="line"><span class="built_in">String</span>.indexOf( ) 检索字符串 </div><div class="line"><span class="built_in">String</span>.lastIndexOf( ) 从后向前检索一个字符串 </div><div class="line"><span class="built_in">String</span>.length 字符串的长度 </div><div class="line"><span class="built_in">String</span>.localeCompare( ) 用本地特定的顺序来比较两个字符串 </div><div class="line"><span class="built_in">String</span>.slice( ) 抽取一个子串 </div><div class="line"><span class="built_in">String</span>.split( ) 将字符串分割成字符串数组 </div><div class="line"><span class="built_in">String</span>.substr( ) 抽取一个子串 </div><div class="line"><span class="built_in">String</span>.substring( ) 返回字符串的一个子串 </div><div class="line"><span class="built_in">String</span>.toLocaleLowerCase( ) 把字符串转换小写 </div><div class="line"><span class="built_in">String</span>.toLocaleUpperCase( ) 将字符串转换成大写 </div><div class="line"><span class="built_in">String</span>.toLowerCase( ) 将字符串转换成小写 </div><div class="line"><span class="built_in">String</span>.toString( ) 返回字符串 </div><div class="line"><span class="built_in">String</span>.toUpperCase( ) 将字符串转换成大写 </div><div class="line"><span class="built_in">String</span>.valueOf( ) 返回字符串 </div><div class="line"><span class="number">7.</span>其他</div><div class="line"><span class="built_in">parseInt</span>(x,<span class="number">16</span>/<span class="number">10</span>/<span class="number">8</span>) --- 如果x=<span class="number">08</span> 有没有指定radix 那就会输出<span class="number">8</span>进制</div><div class="line"><span class="built_in">parseFloat</span>(x,<span class="number">16</span>/<span class="number">10</span>/<span class="number">8</span>)</div><div class="line"><span class="built_in">isNaN</span>()</div><div class="line"><span class="built_in">isFinite</span>() 检测是不是infinity与<span class="literal">NaN</span></div><div class="line"><span class="built_in">escape</span>() 对整个字符串进行转义 (% ? 等在url中有意义的也会被转义)</div><div class="line"><span class="built_in">encodeURI</span>() 对URL进行转义(只会对参数)  --- decode...反转义</div><div class="line"><span class="built_in">encodeURIComponent</span>() 对整个url转义(当url作为参数时,如跳转)</div></pre></td></tr></table></figure>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/lh706.github.io/tags/JavaScript/" rel="tag"># JavaScript</a>
          
            <a href="/lh706.github.io/tags/总结/" rel="tag"># 总结</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/lh706.github.io/2017/05/20/对象拷贝与继承/" rel="prev" title="对象拷贝与继承">
                对象拷贝与继承 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/lh706.github.io/my.jpg"
               alt="Albert" />
          <p class="site-author-name" itemprop="name">Albert</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
           
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/lh706.github.io/archives">
                <span class="site-state-item-count">20</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/lh706.github.io/tags/index.html">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/lh706" target="_blank" title="GitHub">
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.zhihu.com/people/liang-da-shu-shu" target="_blank" title="知乎">
                  
                  知乎
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#基础"><span class="nav-number">1.</span> <span class="nav-text">基础</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#数据类型"><span class="nav-number">1.1.</span> <span class="nav-text">数据类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#控制结构"><span class="nav-number">1.2.</span> <span class="nav-text">控制结构</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#变量-作用域和内存"><span class="nav-number">1.3.</span> <span class="nav-text">变量,作用域和内存</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#引用类型"><span class="nav-number">1.4.</span> <span class="nav-text">引用类型</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#面向对象"><span class="nav-number">2.</span> <span class="nav-text">面向对象</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#函数"><span class="nav-number">3.</span> <span class="nav-text">函数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他"><span class="nav-number">4.</span> <span class="nav-text">其他</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#错误处理"><span class="nav-number">4.1.</span> <span class="nav-text">错误处理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常用操作符与方法汇总"><span class="nav-number">4.2.</span> <span class="nav-text">常用操作符与方法汇总</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Albert</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/fastclick/1.0.6/fastclick.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazyload/1.9.3/jquery.lazyload.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.pack.js"></script>

  
  <script type="text/javascript" src="/lh706.github.io/lib/canvas-nest/canvas-nest.min.js"></script>


  


  <script type="text/javascript" src="/lh706.github.io/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/lh706.github.io/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/lh706.github.io/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/lh706.github.io/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/lh706.github.io/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

</body>
</html>
